
const app = getApp()
const $api = require('../../../utils/api.js').API;

Page({
    data: {
        list:{}
    },
    onShow: function(){
        wx.showLoading()
        this.getlist();
    },
    getlist: function(){
        var that = this
        var data ={'uid':wx.getStorageSync('uid')}
        $api.get('online/user',data).then(res => {
            if(res.data.code == 1){
                wx.hideLoading()
                that.setData({
                    list:res.data.data
                })
            }
        })
    },
    touser:function(e){
        var id = e.currentTarget.dataset.touser
        wx.navigateTo({
            url: '/pages/message/online/toCompany?touid='+id
        })
    },
    delete:function(e){
        var touid = e.currentTarget.dataset.touser
        var data ={'uid':wx.getStorageSync('uid'),'touid':touid}
        var that = this
        $api.delete('online/delete',data).then(res => {
            wx.showToast({
                title:'删除成功',
                duration:3000,
                mask:true,
                icon:'success', 
            })
            wx.showLoading()
            that.getlist();
        }).catch(err => {
            //请求失败
        })
    },
    onShareAppMessage: function() {
        return {
            title: "天意美业直通车",
            path: "/pages/index/index?puid="+wx.getStorageSync('uid')
        };
      }
});